package com.ruoyi.stock.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.stock.mapper.StockHoldMapper;
import com.ruoyi.stock.domain.StockHold;
import com.ruoyi.stock.service.IStockHoldService;

/**
 * 持仓记录
Service业务层处理
 * 
 * @author xxb
 * @date 2024-12-30
 */
@Service
public class StockHoldServiceImpl implements IStockHoldService 
{
    @Autowired
    private StockHoldMapper stockHoldMapper;

    /**
     * 查询持仓记录

     * 
     * @param id 持仓记录
主键
     * @return 持仓记录

     */
    @Override
    public StockHold selectStockHoldById(Long id)
    {
        return stockHoldMapper.selectStockHoldById(id);
    }

    /**
     * 查询持仓记录
列表
     * 
     * @param stockHold 持仓记录

     * @return 持仓记录

     */
    @Override
    public List<StockHold> selectStockHoldList(StockHold stockHold)
    {
        return stockHoldMapper.selectStockHoldList(stockHold);
    }

    /**
     * 新增持仓记录

     * 
     * @param stockHold 持仓记录

     * @return 结果
     */
    @Override
    public int insertStockHold(StockHold stockHold)
    {
        stockHold.setCreateTime(DateUtils.getNowDate());
        return stockHoldMapper.insertStockHold(stockHold);
    }

    /**
     * 修改持仓记录

     * 
     * @param stockHold 持仓记录

     * @return 结果
     */
    @Override
    public int updateStockHold(StockHold stockHold)
    {
        stockHold.setUpdateTime(DateUtils.getNowDate());
        return stockHoldMapper.updateStockHold(stockHold);
    }

    /**
     * 批量删除持仓记录

     * 
     * @param ids 需要删除的持仓记录
主键
     * @return 结果
     */
    @Override
    public int deleteStockHoldByIds(Long[] ids)
    {
        return stockHoldMapper.deleteStockHoldByIds(ids);
    }

    /**
     * 删除持仓记录
信息
     * 
     * @param id 持仓记录
主键
     * @return 结果
     */
    @Override
    public int deleteStockHoldById(Long id)
    {
        return stockHoldMapper.deleteStockHoldById(id);
    }
}
